package com.gy.smartmanagement.process.processdevice.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.gy.smartmanagement.R;
import com.gy.smartmanagement.base.fragment.BaseListFragment;
import com.gy.smartmanagement.process.processdevice.adapter.NumberAdapter;
import com.gy.smartmanagement.process.processdevice.mvp.NumberBean;

import java.util.ArrayList;
import java.util.List;

import androidx.recyclerview.widget.LinearLayoutManager;
import butterknife.BindView;
import tl.com.easy_recycleview_library.BaseRecyclerViewAdapter;
import tl.com.easy_recycleview_library.interfaces.OnItemClickListener;

public class NumberFragment extends BaseListFragment<NumberBean> {

  @BindView(R.id.device_total_tv)
  TextView device_total_tv;
  @BindView(R.id.device_open_tv)
  TextView device_open_tv;
  @BindView(R.id.device_close_tv)
  TextView device_close_tv;


  public static final String TAG = "NumberFragment";

  public static NumberFragment newInstance() {

    Bundle args = new Bundle();

    NumberFragment fragment = new NumberFragment();
    fragment.setArguments(args);
    return fragment;
  }

  @Override
  public int getLayoutResId() {
    return R.layout.fragment_device_number;
  }

  @Override
  public void onUnBind() {

  }


  @Override
  protected void initView() {
    //模拟组装10个数据
    List<NumberBean> dataList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
      NumberBean bean = new NumberBean();
      bean.setName("data.add " + i);
      bean.setTotalNum(100);
      bean.setOpenNum(i);
      bean.setCloseNum(100 - i);
      dataList.add(bean);
    }
    NumberAdapter numberAdapter = new NumberAdapter(getContext(), dataList,
        R.layout.item_device_number);
    BaseRecyclerViewAdapter adapter = new BaseRecyclerViewAdapter(numberAdapter);
    recycleView.setLayoutManager(new LinearLayoutManager(getContext()));
    recycleView.setAdapter(adapter);
    canLoadMore(false);
    canPull(false);
    adapter.setOnItemClickListener(new OnItemClickListener() {
      @Override
      public void onItemClick(View view, int position) {

      }
    });
  }


}
